package com.xd.study.activity;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.RadioGroup;

import com.xd.study.R;

/**
 * Created by DGF on 2015/4/22.
 */
public class RadioButtonActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.radiobutton);

        RadioGroup radioGroup = (RadioGroup)this.findViewById(R.id.radioGroup);
        radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                switch (checkedId){
                    case R.id.radio1:
                        Log.i("tag", "boy");
                        break;
                    case R.id.radio2:
                        Log.i("tag", "girl");
                        break;
                }
            }
        });
    }
}
